package com.ruoyi.hospital.controller.member;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.hospital.domain.member.MemberConInfo;
import com.ruoyi.hospital.service.member.IMemberConInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 就诊人Controller
 * 
 * @author wendao
 * @date 2024-10-23
 */
@RestController
@RequestMapping("/hospital/memberConInfo")
public class MemberConInfoController extends BaseController
{
    @Autowired
    private IMemberConInfoService memberConInfoService;

    /**
     * 查询就诊人列表
     */
    @PreAuthorize("@ss.hasPermi('hospital:memberConInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(MemberConInfo memberConInfo)
    {
        startPage();
        List<MemberConInfo> list = memberConInfoService.selectMemberConInfoList(memberConInfo);
        return getDataTable(list);
    }

    /**
     * 导出就诊人列表
     */
    @PreAuthorize("@ss.hasPermi('hospital:memberConInfo:export')")
    @Log(title = "就诊人", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MemberConInfo memberConInfo)
    {
        List<MemberConInfo> list = memberConInfoService.selectMemberConInfoList(memberConInfo);
        ExcelUtil<MemberConInfo> util = new ExcelUtil<MemberConInfo>(MemberConInfo.class);
        util.exportExcel(response, list, "就诊人数据");
    }

    /**
     * 获取就诊人详细信息
     */
    @PreAuthorize("@ss.hasPermi('hospital:memberConInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(memberConInfoService.selectMemberConInfoById(id));
    }

    /**
     * 新增就诊人
     */
    @PreAuthorize("@ss.hasPermi('hospital:memberConInfo:add')")
    @Log(title = "就诊人", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MemberConInfo memberConInfo)
    {
        return toAjax(memberConInfoService.insertMemberConInfo(memberConInfo));
    }

    /**
     * 修改就诊人
     */
    @PreAuthorize("@ss.hasPermi('hospital:memberConInfo:edit')")
    @Log(title = "就诊人", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MemberConInfo memberConInfo)
    {
        return toAjax(memberConInfoService.updateMemberConInfo(memberConInfo));
    }

    /**
     * 删除就诊人
     */
    @PreAuthorize("@ss.hasPermi('hospital:memberConInfo:remove')")
    @Log(title = "就诊人", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(memberConInfoService.deleteMemberConInfoByIds(ids));
    }
}
